package com.woniu51.user.controller;

import com.woniu.common.core.controller.BaseController;
import com.woniu.common.core.domain.AjaxResult;
import com.woniu.common.core.page.TableDataInfo;
import com.woniu51.entity.UnauthUrl;
import com.woniu51.user.service.UnAuthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author 杨光
 * @date 2022年04月01日 10:01
 */
@RestController
public class UnAuthUrlController extends BaseController {


    @Autowired
    private UnAuthService unAuthService;

    @GetMapping("unauthurl/list")
    public TableDataInfo list(UnauthUrl unauthUrl) {

        startPage();
        List<UnauthUrl> list = unAuthService.list(unauthUrl);
        return getDataTable(list);
    }

    @GetMapping(value = "unauthurl/{id}")
    public AjaxResult getById(@PathVariable("id") Integer id)
    {
        return AjaxResult.success(unAuthService.getById(id));
    }

    @PostMapping("unauthurl/add")
    public AjaxResult add(@RequestBody UnauthUrl unauthUrl)
    {
        return toAjax(unAuthService.add(unauthUrl));
    }


    @PutMapping("unauthurl/edit")
    public AjaxResult edit(@RequestBody UnauthUrl unauthUrl)
    {
        return toAjax(unAuthService.edit(unauthUrl));
    }


    @DeleteMapping("unauthurl/{ids}")
    public AjaxResult remove(@PathVariable("ids") Integer[] ids)
    {
        return toAjax(unAuthService.remove(ids));
    }
}
